/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import dao.ConexaoBanco;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author charles
 */
public class Filme extends javax.swing.JFrame {

    /**
     * Creates new form Filme
     */
    DefaultTableModel dtm;
    private static final Filme instancia = new Filme();
    private String capa;
    private File escolhido;
    private File destino;
    private FilmeDetalhes detalhesfilme;
    private static String diretores[];
    private static String diretores_dados[];
    private static int tamanho_diretores;
    private static String atores[];
    private static String atores_dados[];
    private static int tamanho_atores;
    private static String generos[];
    private static String generos_dados[];
    private static int tamanho_generos;
    private String resultado_diretores[][];
    private String resultado_atores[][];
    private String resultado_generos[][];
    private String resultado_atores1[][];
    public ArrayList<String> array = new ArrayList<>();
    private String resultado_diretores1[][];
    public ArrayList<String> array1 = new ArrayList<>();
    private String resultado_genero1[][];
    public ArrayList<String> array2 = new ArrayList<>();
    //variaveis relacionadas com o controle das listas
    private ArrayList<String> cadastrar_atores = new ArrayList<>();
    private ArrayList<String> cadastrar_diretores = new ArrayList<>();
    private ArrayList<String> cadastrar_genero = new ArrayList<>();
    private ArrayList<String> lista_diretores = new ArrayList<>();
    private ArrayList<String> lista_atores = new ArrayList<>();
    private ArrayList<String> lista_generos = new ArrayList<>();

    public Filme() {
        initComponents();
        dtm = (DefaultTableModel) tabela_buscar.getModel();
        iniciarTabelaCategoria();
        initCombobox();
        // this.capa = "";

    }

    public JTable getTabela_Buscar() {
        return this.tabela_buscar;
    }

    public void initCombobox() {
        String select[] = {"nome", "id_ator"};
        String from[] = {"locadora.ator"};
        String on = "";
        String where[] = null;
        resultado_atores = ConexaoBanco.getInstacia().Select(select, from, null, where, "JOIN");
        Filme.atores = new String[resultado_atores.length];
        Filme.atores_dados = new String[resultado_atores.length];
        for (int i = 0; i < resultado_atores.length; i++) {
            this.ator.addItem(resultado_atores[i][0].toString());
            Filme.atores[i] = resultado_atores[i][1];
            //Filme.atores_dados[i] = resultado_atores[i][0];
        }
        //tamanho_atores = r.length;
        select[0] = "nome";
        select[1] = "id_diretor";
        from[0] = "locadora.diretor";
        on = "";
        where = null;
        resultado_diretores = ConexaoBanco.getInstacia().Select(select, from, null, where, "JOIN");

        // tamanho_diretores = r.length;
        Filme.diretores = new String[resultado_diretores.length];
        Filme.diretores_dados = new String[resultado_diretores.length];
        for (int i = 0; i < resultado_diretores.length; i++) {
            this.diretor.addItem(resultado_diretores[i][0].toString());
            Filme.diretores[i] = resultado_diretores[i][1];
            //Filme.diretores_dados[i] = resultado_atores[i][0];
        }

        select[0] = "nome";
        select[1] = "id_genero";
        from[0] = "locadora.genero";
        on = "";
        where = null;
        resultado_generos = ConexaoBanco.getInstacia().Select(select, from, null, where, "JOIN");

        //tamanho_generos = r.length;
        Filme.generos = new String[resultado_generos.length];
        Filme.generos_dados = new String[resultado_generos.length];
        for (int i = 0; i < resultado_generos.length; i++) {
            this.genero.addItem(resultado_generos[i][0].toString());
            Filme.generos[i] = resultado_generos[i][1];
            //Filme.generos_dados[i] = resultado_atores[i][0];
        }

    }

    public static Filme getInstancia() {
        return Filme.instancia;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        nome_busca = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabela_buscar = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        detalhes = new javax.swing.JButton();
        detalhes1 = new javax.swing.JButton();
        adicionar_copias = new javax.swing.JButton();
        remover = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        nome = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        sinopse = new javax.swing.JTextArea();
        jLabel4 = new javax.swing.JLabel();
        duracao = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        categoria = new javax.swing.JComboBox();
        preco_label = new javax.swing.JLabel();
        genero = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        lista_genero = new javax.swing.JList();
        jLabel13 = new javax.swing.JLabel();
        ator = new javax.swing.JComboBox();
        jScrollPane4 = new javax.swing.JScrollPane();
        lista_ator = new javax.swing.JList();
        jScrollPane5 = new javax.swing.JScrollPane();
        lista_diretor = new javax.swing.JList();
        diretor = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        adicionar_genero = new javax.swing.JButton();
        adicionar_ator = new javax.swing.JButton();
        adicionar_diretor = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        ano_lancamento = new javax.swing.JTextField();
        traducao = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        adicionar_diretor1 = new javax.swing.JButton();
        adicionar_ator1 = new javax.swing.JButton();
        adicionar_genero1 = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        nome_ator = new javax.swing.JTextField();
        jButton6 = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        nome_diretor = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jButton7 = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        nome_genero = new javax.swing.JTextField();
        jButton8 = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        jButton9 = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        nome_categoria = new javax.swing.JTextField();
        preco_categoria = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        nome_ator1 = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jButton10 = new javax.swing.JButton();
        ator_box = new javax.swing.JComboBox();
        jButton11 = new javax.swing.JButton();
        jButton12 = new javax.swing.JButton();
        jPanel9 = new javax.swing.JPanel();
        nome_diretor1 = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jButton13 = new javax.swing.JButton();
        diretor_box = new javax.swing.JComboBox();
        jButton14 = new javax.swing.JButton();
        jButton15 = new javax.swing.JButton();
        jPanel11 = new javax.swing.JPanel();
        nome_genero1 = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jButton16 = new javax.swing.JButton();
        genero_box = new javax.swing.JComboBox();
        jButton17 = new javax.swing.JButton();
        jButton18 = new javax.swing.JButton();
        jPanel12 = new javax.swing.JPanel();
        nome_categoria1 = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jButton19 = new javax.swing.JButton();
        categoria_box = new javax.swing.JComboBox();
        jButton20 = new javax.swing.JButton();
        jButton21 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jTabbedPane1.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N

        jPanel1.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N

        jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel1.setText("NOME");

        jScrollPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jScrollPane1MouseClicked(evt);
            }
        });

        tabela_buscar.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "IdFilme", "Nome", "Data de Lançamento", "Número de Cópias"
            }
        ));
        tabela_buscar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabela_buscarMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tabela_buscar);

        jButton1.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton1.setText("BUSCAR");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        detalhes.setText("Detalhes");
        detalhes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                detalhesActionPerformed(evt);
            }
        });

        detalhes1.setText("Alterar");
        detalhes1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                detalhes1ActionPerformed(evt);
            }
        });

        adicionar_copias.setText("Adicionar Cópias");
        adicionar_copias.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adicionar_copiasActionPerformed(evt);
            }
        });

        remover.setText("Remover Filme");
        remover.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removerActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jButton1)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLabel1)
                                    .addGap(18, 18, 18)
                                    .addComponent(nome_busca, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(27, 27, 27)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(146, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(detalhes1)
                        .addGap(18, 18, 18)
                        .addComponent(adicionar_copias)
                        .addGap(37, 37, 37)
                        .addComponent(remover)
                        .addGap(18, 18, 18)
                        .addComponent(detalhes)
                        .addGap(163, 163, 163))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(nome_busca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 167, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(detalhes, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(detalhes1)
                        .addComponent(adicionar_copias)
                        .addComponent(remover)))
                .addGap(41, 41, 41))
        );

        jTabbedPane1.addTab("Buscar Filme", jPanel1);

        jPanel2.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jPanel2.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jPanel2ComponentShown(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel2.setText("NOME");

        jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel3.setText("SINOPSE");

        sinopse.setColumns(20);
        sinopse.setRows(5);
        jScrollPane2.setViewportView(sinopse);

        jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel4.setText("DURACAO");

        jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel5.setText("CAPA");

        jButton2.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton2.setText("SELECIONAR");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton3.setText("CONFIRMAR");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel6.setText("CATEGORIA");

        categoria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                categoriaActionPerformed(evt);
            }
        });

        genero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generoActionPerformed(evt);
            }
        });

        jLabel12.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel12.setText("GENERO(S)");

        jScrollPane3.setViewportView(lista_genero);

        jLabel13.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel13.setText("ATOR(ES)");

        ator.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                atorActionPerformed(evt);
            }
        });

        jScrollPane4.setViewportView(lista_ator);

        jScrollPane5.setViewportView(lista_diretor);

        diretor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                diretorActionPerformed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel14.setText("DIRETOR(ES)");

        adicionar_genero.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        adicionar_genero.setText("ADICIONAR");
        adicionar_genero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adicionar_generoActionPerformed(evt);
            }
        });

        adicionar_ator.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        adicionar_ator.setText("ADICIONAR");
        adicionar_ator.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adicionar_atorActionPerformed(evt);
            }
        });

        adicionar_diretor.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        adicionar_diretor.setText("ADICIONAR");
        adicionar_diretor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adicionar_diretorActionPerformed(evt);
            }
        });

        jLabel15.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel15.setText("Ano de Lançamento");

        jLabel18.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel18.setText("Tradução");

        adicionar_diretor1.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        adicionar_diretor1.setText("REMOVER");
        adicionar_diretor1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adicionar_diretor1ActionPerformed(evt);
            }
        });

        adicionar_ator1.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        adicionar_ator1.setText("REMOVER");
        adicionar_ator1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adicionar_ator1ActionPerformed(evt);
            }
        });

        adicionar_genero1.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        adicionar_genero1.setText("REMOVER");
        adicionar_genero1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adicionar_genero1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(27, 27, 27)
                        .addComponent(jScrollPane2))
                    .addComponent(jButton3)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5)
                            .addComponent(jLabel2))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(nome, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jButton2)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel6)
                                .addGap(18, 18, 18)
                                .addComponent(categoria, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(duracao, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel15)
                                .addGap(18, 18, 18)
                                .addComponent(ano_lancamento, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel18)
                                .addGap(18, 18, 18)
                                .addComponent(traducao, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(diretor, 0, 114, Short.MAX_VALUE)
                                        .addComponent(jLabel14)
                                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                                    .addComponent(adicionar_diretor)
                                    .addComponent(adicionar_diretor1, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 86, Short.MAX_VALUE)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel12)
                                        .addGap(78, 78, 78))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(adicionar_ator1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(adicionar_ator, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                .addComponent(ator, 0, 114, Short.MAX_VALUE)
                                                .addComponent(jLabel13)
                                                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
                                        .addGap(70, 70, 70)
                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel2Layout.createSequentialGroup()
                                                .addComponent(genero, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(46, 46, 46)
                                                .addComponent(preco_label))
                                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                .addComponent(adicionar_genero1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(adicionar_genero, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))))))
                .addContainerGap(65, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(32, 32, 32)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(nome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(duracao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jButton2)
                    .addComponent(jLabel6)
                    .addComponent(categoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(genero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(preco_label))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(adicionar_genero)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(24, 24, 24)
                                .addComponent(ator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel14)
                                    .addComponent(jLabel13))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(diretor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(adicionar_ator)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(adicionar_diretor)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(adicionar_diretor1)
                    .addComponent(adicionar_ator1)
                    .addComponent(adicionar_genero1))
                .addGap(38, 38, 38)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel18)
                        .addComponent(traducao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel15)
                        .addComponent(ano_lancamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(27, 27, 27)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton3)
                .addGap(10, 10, 10))
        );

        jTabbedPane1.addTab("Cadastrar Filme", jPanel2);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Ator"));

        jLabel9.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel9.setText("NOME");

        jButton6.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton6.setText("INSERIR");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
                        .addComponent(nome_ator, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton6)))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(nome_ator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton6))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Diretor"));

        jLabel10.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel10.setText("NOME");

        jButton7.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton7.setText("INSERIR");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(nome_diretor, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton7)))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(nome_diretor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton7))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Gênero"));

        jLabel11.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel11.setText("NOME");

        jButton8.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton8.setText("INSERIR");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
                        .addComponent(nome_genero, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton8)))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(nome_genero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
                .addComponent(jButton8))
        );

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Categoria"));

        jButton9.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton9.setText("INSERIR");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        jLabel19.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel19.setText("NOME");

        jLabel20.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel20.setText("PREÇO");

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton9)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel19)
                    .addComponent(jLabel20))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(nome_categoria, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(preco_categoria, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(nome_categoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(preco_categoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addComponent(jButton9))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(147, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(14, 14, 14)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(103, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Cadastro Geral", jPanel4);

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Ator"));

        jLabel16.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel16.setText("NOME");

        jButton10.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton10.setText("BUSCAR");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        jButton11.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton11.setText("ALTERAR");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        jButton12.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton12.setText("REMOVER");
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(nome_ator1, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(ator_box, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton12)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(nome_ator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ator_box, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton11)
                    .addComponent(jButton12)))
        );

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Diretor"));

        jLabel17.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel17.setText("NOME");

        jButton13.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton13.setText("BUSCAR");
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });

        jButton14.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton14.setText("ALTERAR");
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });

        jButton15.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton15.setText("REMOVER");
        jButton15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton15ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(nome_diretor1, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(28, 28, 28)
                        .addComponent(jButton13, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(diretor_box, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton15)))
                .addContainerGap(55, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(nome_diretor1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton13))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(diretor_box, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton14)
                    .addComponent(jButton15)))
        );

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Genero"));

        jLabel21.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel21.setText("NOME");

        jButton16.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton16.setText("BUSCAR");
        jButton16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton16ActionPerformed(evt);
            }
        });

        jButton17.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton17.setText("ALTERAR");
        jButton17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton17ActionPerformed(evt);
            }
        });

        jButton18.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton18.setText("REMOVER");
        jButton18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton18ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(nome_genero1, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(genero_box, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton17, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton18)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(nome_genero1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton16))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(genero_box, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton17)
                    .addComponent(jButton18)))
        );

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder("Categoria"));

        jLabel22.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jLabel22.setText("NOME");

        jButton19.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton19.setText("BUSCAR");
        jButton19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton19ActionPerformed(evt);
            }
        });

        jButton20.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton20.setText("ALTERAR");
        jButton20.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton20ActionPerformed(evt);
            }
        });

        jButton21.setFont(new java.awt.Font("Times New Roman", 0, 15)); // NOI18N
        jButton21.setText("REMOVER");
        jButton21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton21ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(nome_categoria1, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jButton19, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addComponent(categoria_box, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton20, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton21)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(nome_categoria1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton19))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(categoria_box, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton20)
                    .addComponent(jButton21)))
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(169, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Alterar/Remover", jPanel3);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        buscarFilme();

    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        //Seleciona o Local onde deseja Salvar
        JFileChooser arquivo = new JFileChooser();
        FileFilter filter = new FileNameExtensionFilter("imagens", "png", "jpg", "gif");
        arquivo.setFileFilter(filter);
        int retorno = arquivo.showOpenDialog(null);

        if (retorno == JFileChooser.APPROVE_OPTION) {
            capa = arquivo.getSelectedFile().getAbsolutePath();
            this.escolhido = new File(capa);
            System.out.println(capa);
        } else {
            System.out.println("Erro ao abrir a janela");
        }


    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
        //primeiro deve-se fazer a consulta para verificar qual que é o id da
        //categoria para depois fazer a inserção do filme   

        if (capa != null) {
            try {
                //JOptionPane.showMessageDialog(null, capa);
                String capa_destinho = "capa/" + escolhido.getName();
                this.destino = new File(capa_destinho);
                if (destino.createNewFile()) {
                    System.out.println("criou");
                    copyFile(escolhido, destino);

                } else {
                    System.out.println("erro");
                }
                //FileWriter f = new FileWriter(new File(capa));
                this.capa = capa_destinho;


            } catch (IOException ex) {
                Logger.getLogger(Filme.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        System.out.println(this.categoria.getSelectedItem().toString());

        //cadastrar filme
        //ConexaoBanco.getInstacia().cadastrarFilme(this.nome.getText(),
        //      this.duracao.getText(), this.capa, this.sinopse.getText(), this.categoria.getSelectedItem().toString());
        String into_values[] = {"nome", "duracao", "capa", "sinopse", "categoria", "ano_lancamento", "traducao"};
        String values[] = {this.nome.getText(), this.duracao.getText(), this.capa, this.sinopse.getText(),
            this.categoria.getSelectedItem().toString(), this.ano_lancamento.getText(), this.traducao.getText()};
        ConexaoBanco.getInstacia().Inserir("locadora", "filme", into_values, values);

        //pega o id do filme que acabou de ser inserido
        String select[] = {"id_filme"};
        String from[] = {"locadora.filme"};
        String where[] = {"nome = '" + this.nome.getText() + "'", "duracao = '" + this.duracao.getText() + "'"};
        String getidfilme[][] = ConexaoBanco.getInstacia().Select(select, from, null, where, "JOIN");
        System.out.println("IDFILME " + getidfilme[0][0]);

        //insere os dados referentes aos diretores
        String l_diretor[] = {"id_diretor", "id_filme"};
        String select_d[] = {"id_diretor"};
        String from_d[] = {"locadora.diretor"};

        //insercao na tabela filme_diretor
        for (int i = 0; i < this.lista_diretores.size(); i++) {
            System.out.println("NOME DOS DIRETORES: " + this.lista_diretores.get(i));
            String where_d[] = {"nome = '" + (String) this.lista_diretores.get(i) + "'"};
            String r_diretor[][] = ConexaoBanco.getInstacia().Select(select_d, from_d, null, where_d, "");

            String nomes[] = {r_diretor[0][0], getidfilme[0][0]};
            ConexaoBanco.getInstacia().Inserir("locadora", "filme_diretor", l_diretor, nomes);

        }


        //insere os dados referentes aos atores
        String l_ator[] = {"id_ator", "id_filme"};
        String select_a[] = {"id_ator"};
        String from_a[] = {"locadora.ator"};

        //insercao na tabela filme_ator
        for (int i = 0; i < this.lista_atores.size(); i++) {
            String where_a[] = {"nome = '" + (String) this.lista_atores.get(i) + "'"};
            String r_ator[][] = ConexaoBanco.getInstacia().Select(select_a, from_a, null, where_a, "");
            String nomes[] = {r_ator[0][0], getidfilme[0][0]};
            ConexaoBanco.getInstacia().Inserir("locadora", "filme_ator", l_ator, nomes);
        }


        //insere os dados referentes aos generos
        String l_genero[] = {"id_genero", "id_filme"};
        String select_g[] = {"id_genero"};
        String from_g[] = {"locadora.genero"};

        //insercao na tabela filme_ator
        for (int i = 0; i < this.lista_generos.size(); i++) {
            String where_g[] = {"nome = '" + (String) this.lista_generos.get(i) + "'"};
            String r_genero[][] = ConexaoBanco.getInstacia().Select(select_g, from_g, null, where_g, "");
            String nomes[] = {r_genero[0][0], getidfilme[0][0]};
            ConexaoBanco.getInstacia().Inserir("locadora", "filme_genero", l_genero, nomes);

        }


    }//GEN-LAST:event_jButton3ActionPerformed

    private void jPanel2ComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jPanel2ComponentShown
        // TODO add your handling code here:
        //System.out.println("entou!!!");
    }//GEN-LAST:event_jPanel2ComponentShown

    private void categoriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_categoriaActionPerformed
        // TODO add your handling code here:
        //System.out.println("ACIONOU!!");
        //String valor = ConexaoBanco.getInstacia().getValorCategoria(this.categoria.getSelectedItem().toString());
        // this.preco_label.setText("PREÇO R$ "+valor);
    }//GEN-LAST:event_categoriaActionPerformed

    private void jScrollPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane1MouseClicked
        // TODO add your handling code here:
        //System.out.println("clicou na tabela");
    }//GEN-LAST:event_jScrollPane1MouseClicked

    private void tabela_buscarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabela_buscarMouseClicked
        // TODO add your handling code here:
        System.out.println(tabela_buscar.getSelectedRow());
        System.out.println("valor " + (String) this.tabela_buscar.
                getValueAt(tabela_buscar.getSelectedRow(), tabela_buscar.getSelectedColumn()));

    }//GEN-LAST:event_tabela_buscarMouseClicked

    private void detalhesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detalhesActionPerformed
        // TODO add your handling code here:
        if (this.tabela_buscar.getSelectedColumn() == -1) {
            JOptionPane.showMessageDialog(null, "Nada foi selecionado");
        } else {
            this.detalhesfilme = new FilmeDetalhes();
        }
    }//GEN-LAST:event_detalhesActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        // TODO add your handling code here:
        String insert[] = {"nome"};
        String values[] = {this.nome_ator.getText()};
        if (ConexaoBanco.getInstacia().Inserir("locadora", "ator", insert, values)) {
            JOptionPane.showMessageDialog(null, "Inserido!");
            this.ator.addItem(this.nome_ator.getText());
        } else {
            System.out.println("ERRO");
        }

    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        // TODO add your handling code here:
        String insert[] = {"nome"};
        String values[] = {this.nome_diretor.getText()};
        if (ConexaoBanco.getInstacia().Inserir("locadora", "diretor", insert, values)) {
            JOptionPane.showMessageDialog(null, "Inserido!");
            this.diretor.addItem(this.nome_diretor.getText());
        } else {
            System.out.println("ERRO");
        }
    }//GEN-LAST:event_jButton7ActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        // TODO add your handling code here:
        String insert[] = {"nome"};
        String values[] = {this.nome_genero.getText()};
        if (ConexaoBanco.getInstacia().Inserir("locadora", "genero", insert, values)) {
            JOptionPane.showMessageDialog(null, "Inserido!");
            this.genero.addItem(this.nome_genero.getText());
        } else {
            System.out.println("ERRO");
        }
    }//GEN-LAST:event_jButton8ActionPerformed

    private void generoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_generoActionPerformed

    private void atorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_atorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_atorActionPerformed

    private void diretorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_diretorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_diretorActionPerformed

    private void adicionar_generoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adicionar_generoActionPerformed
        // TODO add your handling code here:
        if (this.genero.getSelectedItem() != null) {
            if (!this.lista_generos.contains((String) this.genero.getSelectedItem())) {
                Filme.generos_dados[tamanho_generos] = (String) this.genero.getSelectedItem();
                this.cadastrar_genero.add((String) this.genero.getSelectedItem());
                this.lista_generos.add((String) this.genero.getSelectedItem());
                this.lista_genero.setListData(Filme.generos_dados);
                tamanho_generos = (tamanho_generos + 1) % Filme.generos.length;
            }
        }

    }//GEN-LAST:event_adicionar_generoActionPerformed

    private void adicionar_atorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adicionar_atorActionPerformed
        // TODO add your handling code here:
        if (this.ator.getSelectedItem() != null) {
            if (!this.lista_atores.contains((String) this.ator.getSelectedItem())) {
                Filme.atores_dados[tamanho_atores] = (String) this.ator.getSelectedItem();
                this.cadastrar_atores.add((String) this.ator.getSelectedItem());
                this.lista_ator.setListData(Filme.atores_dados);
                this.lista_atores.add((String) this.ator.getSelectedItem());
                tamanho_atores = (tamanho_atores + 1) % Filme.atores.length;
            }
        }
        //tamanho_atores++;
    }//GEN-LAST:event_adicionar_atorActionPerformed

    private void adicionar_diretorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adicionar_diretorActionPerformed
        // TODO add your handling code here:
        //Filme.diretores[tamanho_diretores] = this.resultado_diretores[tamanho_diretores][1];

        if (this.diretor.getSelectedItem() != null) {
            if (!this.lista_diretores.contains((String) this.diretor.getSelectedItem())) {
                Filme.diretores_dados[tamanho_diretores] = (String) this.diretor.getSelectedItem();
                this.cadastrar_diretores.add((String) this.diretor.getSelectedItem());
                this.lista_diretor.setListData(Filme.diretores_dados);
                this.lista_diretores.add((String) this.diretor.getSelectedItem());
                tamanho_diretores = (tamanho_diretores + 1) % Filme.diretores.length;
            }
        }

        //tamanho_diretores++;
    }//GEN-LAST:event_adicionar_diretorActionPerformed

    private void detalhes1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detalhes1ActionPerformed
        // TODO add your handling code here:
        if (this.tabela_buscar.getSelectedColumn() == -1) {
            JOptionPane.showMessageDialog(null, "Nada foi selecionado");
        } else {
            AlterarFilme alterar_filme = new AlterarFilme();
        }
    }//GEN-LAST:event_detalhes1ActionPerformed

    private void adicionar_copiasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adicionar_copiasActionPerformed
        // TODO add your handling code here:

        if (this.tabela_buscar.getSelectedColumn() == -1) {
            JOptionPane.showMessageDialog(null, "Nada foi selecionado");
        } else {
            Copia copia = Copia.getInstacia();
            copia.setVisible(true);
            copia.setLocationRelativeTo(null);
        }
    }//GEN-LAST:event_adicionar_copiasActionPerformed

    private void removerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removerActionPerformed
        // TODO add your handling code here:
        if (this.tabela_buscar.getSelectedColumn() == -1) {
            JOptionPane.showMessageDialog(null, "Nada foi selecionado");
        } else {
            String where[] = {"id_filme = " + (String) Filme.getInstancia().getTabela_Buscar().
                getValueAt(Filme.getInstancia().getTabela_Buscar().getSelectedRow(), 0)};
            ConexaoBanco.getInstacia().delete("locadora.filme", where);
            JOptionPane.showMessageDialog(null, "Removido!");
        }
    }//GEN-LAST:event_removerActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        // TODO add your handling code here:
        boolean sanidade = ConexaoBanco.getInstacia().cadastrarCategoria(this.nome_categoria.getText(),
                this.preco_categoria.getText());
        if (sanidade) {

            this.categoria.addItem(this.nome_categoria.getText());
        }
    }//GEN-LAST:event_jButton9ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        // TODO add your handling code here:
        String select[] = {"nome", "id_ator"};
        String from[] = {"locadora.ator"};
        String on = "";
        String where[] = {"nome LIKE '%" + this.nome_ator1.getText() + "%'"};
        resultado_atores1 = ConexaoBanco.getInstacia().Select(select, from, null, where, "JOIN");
        //Filme.atores = new String[resultado_atores.length];
        //Filme.atores_dados = new String[resultado_atores.length];

        for (int i = 0; i < resultado_atores1.length; i++) {
            if (!this.array.contains(resultado_atores1[i][0].toString())) {
                this.ator_box.addItem(resultado_atores1[i][0].toString());
                this.array.add(resultado_atores1[i][0].toString());

            }
            // Filme.atores[i] = resultado_atores1[i][1];
            //Filme.atores_dados[i] = resultado_atores[i][0];
        }
    }//GEN-LAST:event_jButton10ActionPerformed

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        // TODO add your handling code here:
        AlterarAtor alterarator = AlterarAtor.getInstancia();
        alterarator.setVisible(true);
        alterarator.setLocationRelativeTo(null);

    }//GEN-LAST:event_jButton11ActionPerformed

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
        // TODO add your handling code here:
        String where[] = {"nome = '" + this.ator_box.getSelectedItem().toString() + "'"};
        ConexaoBanco.getInstacia().delete("locadora.ator", where);
    }//GEN-LAST:event_jButton12ActionPerformed

    private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
        // TODO add your handling code here:
        String select[] = {"nome", "id_diretor"};
        String from[] = {"locadora.diretor"};
        String on = "";
        String where[] = {"nome LIKE '%" + this.nome_diretor1.getText() + "%'"};
        resultado_diretores1 = ConexaoBanco.getInstacia().Select(select, from, null, where, "JOIN");
        //Filme.atores = new String[resultado_atores.length];
        //Filme.atores_dados = new String[resultado_atores.length];

        for (int i = 0; i < resultado_diretores1.length; i++) {
            if (!this.array1.contains(resultado_diretores1[i][0].toString())) {
                this.diretor_box.addItem(resultado_diretores1[i][0].toString());
                this.array1.add(resultado_diretores1[i][0].toString());

            }
        }
    }//GEN-LAST:event_jButton13ActionPerformed

    private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
        // TODO add your handling code here:
        AlterarDiretor alterardiretor = AlterarDiretor.getInstancia();
        alterardiretor.setVisible(true);
        alterardiretor.setLocationRelativeTo(null);
    }//GEN-LAST:event_jButton14ActionPerformed

    private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
        // TODO add your handling code here:
        String where[] = {"nome = '" + this.diretor_box.getSelectedItem().toString() + "'"};
        ConexaoBanco.getInstacia().delete("locadora.diretor", where);

    }//GEN-LAST:event_jButton15ActionPerformed

    private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
        // TODO add your handling code here:
        String select[] = {"nome", "id_genero"};
        String from[] = {"locadora.genero"};
        String on = "";
        String where[] = {"nome LIKE '%" + this.nome_genero1.getText() + "%'"};
        resultado_genero1 = ConexaoBanco.getInstacia().Select(select, from, null, where, "JOIN");
        //Filme.atores = new String[resultado_atores.length];
        //Filme.atores_dados = new String[resultado_atores.length];

        for (int i = 0; i < resultado_genero1.length; i++) {
            if (!this.array2.contains(resultado_genero1[i][0].toString())) {
                this.genero_box.addItem(resultado_genero1[i][0].toString());
                this.array2.add(resultado_genero1[i][0].toString());

            }
        }
    }//GEN-LAST:event_jButton16ActionPerformed

    private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed
        // TODO add your handling code here:
        AlterarGenero alterargenero = AlterarGenero.getInstancia();
        alterargenero.setVisible(true);
        alterargenero.setLocationRelativeTo(null);
    }//GEN-LAST:event_jButton17ActionPerformed

    private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton18ActionPerformed
        // TODO add your handling code here:
        String where[] = {"nome = '" + this.genero_box.getSelectedItem().toString() + "'"};
        ConexaoBanco.getInstacia().delete("locadora.genero", where);
    }//GEN-LAST:event_jButton18ActionPerformed

    private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton19ActionPerformed

    private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton20ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton20ActionPerformed

    private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
        // TODO add your handling code here:
        String where[] = {"nome = '" + this.categoria_box.getSelectedItem().toString() + "'"};
        ConexaoBanco.getInstacia().delete("locadora.categoria", where);
    }//GEN-LAST:event_jButton21ActionPerformed

    private void adicionar_diretor1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adicionar_diretor1ActionPerformed
        // TODO add your handling code here:
        String n[] = {""};
        this.lista_diretor.setListData(n);
        this.lista_diretores = new ArrayList<>();
        for (int i = 0; i < Filme.diretores_dados.length; i++) {
            Filme.diretores_dados[i] = "";

        }
        tamanho_diretores = 0;
    }//GEN-LAST:event_adicionar_diretor1ActionPerformed

    private void adicionar_ator1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adicionar_ator1ActionPerformed
        // TODO add your handling code here:
        String n[] = {""};
        this.lista_ator.setListData(n);
        this.lista_atores = new ArrayList<>();
        //Filme.atores_dados = new String[Filme.atores_dados.length];
        for (int i = 0; i < Filme.atores_dados.length; i++) {
            Filme.atores_dados[i] = "";

        }
        tamanho_atores = 0;
    }//GEN-LAST:event_adicionar_ator1ActionPerformed

    private void adicionar_genero1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adicionar_genero1ActionPerformed
        // TODO add your handling code here:
        String n[] = {""};
        this.lista_genero.setListData(n);
        this.lista_generos = new ArrayList<>();
        for (int i = 0; i < Filme.generos_dados.length; i++) {
            Filme.generos_dados[i] = "";

        }
        tamanho_generos = 0;
    }//GEN-LAST:event_adicionar_genero1ActionPerformed

    public void buscarFilme() {
        String colunas[] = {"idFilme", "Nome", "Data Lancamento", "Numero de Copias"};
        if (this.nome_busca.getText().compareTo("") == 0) {
            String resultado[][] = ConexaoBanco.getInstacia().getDataFilm(this.nome_busca.getText(), " LEFT OUTER JOIN ");
            dtm.setDataVector(resultado, colunas);

        } else {
            String resultado2[][] = ConexaoBanco.getInstacia().getDataFilm(this.nome_busca.getText(), " LEFT OUTER JOIN ");
            dtm.setDataVector(resultado2, colunas);
        }
    }

    public void iniciarTabelaCategoria() {
        System.out.println("adicionou!!");

        ArrayList<String> aux = ConexaoBanco.getInstacia().getAllCategoria();
        for (int i = 0; i < aux.size(); i++) {

            categoria.addItem(aux.get(i));

        }
    }

    public static void addDirector() {
    }

    public static void copyFile(File source, File destination) throws IOException {
        if (destination.exists()) {
            destination.delete();
        }

        FileChannel sourceChannel = null;
        FileChannel destinationChannel = null;

        try {
            sourceChannel = new FileInputStream(source).getChannel();
            destinationChannel = new FileOutputStream(destination).getChannel();
            sourceChannel.transferTo(0, sourceChannel.size(),
                    destinationChannel);
        } finally {
            if (sourceChannel != null && sourceChannel.isOpen()) {
                sourceChannel.close();
            }
            if (destinationChannel != null && destinationChannel.isOpen()) {
                destinationChannel.close();
            }
        }
    }

    public JComboBox getAtor_box() {
        return ator_box;
    }

    public void setAtor_box(JComboBox ator_box) {
        this.ator_box = ator_box;
    }

    public JComboBox getCategoria_box() {
        return categoria_box;
    }

    public void setCategoria_box(JComboBox categoria_box) {
        this.categoria_box = categoria_box;
    }

    public JComboBox getDiretor_box() {
        return diretor_box;
    }

    public void setDiretor_box(JComboBox diretor_box) {
        this.diretor_box = diretor_box;
    }

    public JComboBox getGenero_box() {
        return genero_box;
    }

    public void setGenero_box(JComboBox genero_box) {
        this.genero_box = genero_box;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Filme.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Filme.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Filme.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Filme.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Filme().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton adicionar_ator;
    private javax.swing.JButton adicionar_ator1;
    private javax.swing.JButton adicionar_copias;
    private javax.swing.JButton adicionar_diretor;
    private javax.swing.JButton adicionar_diretor1;
    private javax.swing.JButton adicionar_genero;
    private javax.swing.JButton adicionar_genero1;
    private javax.swing.JTextField ano_lancamento;
    private javax.swing.JComboBox ator;
    private javax.swing.JComboBox ator_box;
    private javax.swing.JComboBox categoria;
    private javax.swing.JComboBox categoria_box;
    private javax.swing.JButton detalhes;
    private javax.swing.JButton detalhes1;
    private javax.swing.JComboBox diretor;
    private javax.swing.JComboBox diretor_box;
    private javax.swing.JTextField duracao;
    private javax.swing.JComboBox genero;
    private javax.swing.JComboBox genero_box;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton16;
    private javax.swing.JButton jButton17;
    private javax.swing.JButton jButton18;
    private javax.swing.JButton jButton19;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton20;
    private javax.swing.JButton jButton21;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JList lista_ator;
    private javax.swing.JList lista_diretor;
    private javax.swing.JList lista_genero;
    private javax.swing.JTextField nome;
    private javax.swing.JTextField nome_ator;
    private javax.swing.JTextField nome_ator1;
    private javax.swing.JTextField nome_busca;
    private javax.swing.JTextField nome_categoria;
    private javax.swing.JTextField nome_categoria1;
    private javax.swing.JTextField nome_diretor;
    private javax.swing.JTextField nome_diretor1;
    private javax.swing.JTextField nome_genero;
    private javax.swing.JTextField nome_genero1;
    private javax.swing.JTextField preco_categoria;
    private javax.swing.JLabel preco_label;
    private javax.swing.JButton remover;
    private javax.swing.JTextArea sinopse;
    private javax.swing.JTable tabela_buscar;
    private javax.swing.JTextField traducao;
    // End of variables declaration//GEN-END:variables
}
